KE.lang['code'] = "插入代码";
KE.plugin['code'] = {
    click : function(id) {
        KE.util.selection(id);
        var dialog = new KE.dialog({
            id : id,
            cmd : 'code',
			file : 'code/code.html',
            width : 400,
            height : 300,
            title : KE.lang['code'],
            yesButton : KE.lang['yes'],
            noButton : KE.lang['no']
        });
        dialog.show();
    },
    exec : function(id) {
        KE.util.select(id);
        var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog);
        var type = KE.$('codeType', dialogDoc).value;
        var html = KE.$('textArea', dialogDoc).value;
        html = "<pre class='brush:"+type+"'>"+html+"</pre>";
        //html = html.replace(/&/g, "&amp;");
        //html = html.replace(/&/g, "&amp;");
        //html = html.replace(/</g, "&lt;");
        //html = html.replace(/>/g, "&gt;");
        var re = new RegExp("\r\n|\n|\r", "g");
        html = html.replace(re, "<br />$&");
        KE.util.insertHtml(id, html);
        KE.layout.hide(id);
        KE.util.focus(id);
    }
};
